package com.nondo.dean.dealer.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.nondo.dean.common.tool.AliyunOssTool;
import com.nondo.dean.dealer.model.result.IndexResult;

/**
 * 首页接口业务类
 * @author zhaolijin
 * @date 2018年5月10日
 */
@Component
public class IndexService {
    
    @Autowired
    AliyunOssTool aliyunOssTool;
    
    @Autowired
    UserService userService;
    
    @Autowired
    SlideService slideService;
    
    @Autowired
    MessageService messageService;

    @Autowired
    StoreService storeService;

    /**
     * 获取首页数据
     * @return
     */
    public IndexResult getIndex() {
        IndexResult indexResult = new IndexResult();
        // 经销商信息
        Integer userId = userService.getLoginUserId();
        String userName = userService.getLoginUserName();
        indexResult.setUser(userService.getUserBeanByName(userName));
        // 幻灯片列表
        indexResult.setSlideList(slideService.getSlideList());
        // 最新消息列表
        indexResult.setMessageList(messageService.getMessageList(userId));
        return indexResult;
    }

}
